<template>
  <div>
    <div class="top">
      <div style="width: 60px" @click="returnTap">取消</div>
      <span>选择联系人</span>
      <van-button v-if="arr==''" type="default"  style="height: 30px">创建</van-button>
       <van-button v-if="arr!=''" type="default" style="height: 30px" @click="finishTap">完成({{arr.length}})</van-button>
    </div>
    <div class="input">
      <div class="inputList" v-if="arr!=''">
        <img src="../../assets/images/logo.png" v-for="item of arr" alt="">
      </div>
      <!-- <van-icon class="input_icon" name="search" /> -->
      <input type="text" class="inputAl" @ placeholder="搜索" />
    </div>
    <div class="list" v-for="item of list">
      <div class="list1">
        <van-checkbox v-model="item.type" @change="checkBoxTap"></van-checkbox>
      </div>
      <div class="list_left">
        <van-badge :content="item.num">
          <img class="list_img" src="../../assets/images/logo.png" alt="" />
        </van-badge>
      </div>
      <div class="list_right">
        <div class="col1">
          <span class="col2">小明</span>
          <span class="col3">2020-08-21</span>
        </div>
        <div class="col1">
          <span class="col4" v-if="item.status == 1">电话:1510000000</span>
          <img v-if="item.status == 1" style="width:20px;" src="../../assets/images/ic_tixing.png" alt="">
        </div>
        <div class="col1">
          <span class="col3">[图片]</span>
          <!-- <span class="col3"></span> -->
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [
        { name: "[图片]", num: 9, status: 0, type: false },
        { name: "[15条]丽丽: 明白", num: 10, status: 1, type: false },
        {
          name: "你好，如果你有任何建议或投诉，请点击此处反...",
          num: 2,
          status: 1,
          type: false,
        },
        { name: "[图片]", num: 9, status: 0, type: false },
      ],
      arr:[]
    };
  },
  methods: {
    returnTap() {
      this.$router.go(-1);
    },
    checkBoxTap() {
      console.log(this.list);
      var list = this.list;
      var arr = [];
      for (var a = 0; a < list.length; a++) {
        if (list[a].type == true) {
          arr.push(list[a]);
        }
      }
      this.arr=arr
    },
    finishTap(){
      this.$router.push("/qun");
    }
  },
};
</script>
<style scoped>
.top {
  height: 60px;
  width: 90%;
  padding: 0 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 60px;
  position: relative;
  background: #eeeeee;
}
.input {
  height: 50px;
  width: 100%;
  text-align: center;
  line-height: 50px;
  position: relative;
  background: #eeeeee;
}
.input_icon {
  position: absolute;
  left: 43%;
  top: 17px;
  font-size: 18px;
}
/* .inputAl::-webkit-input-placeholder {
  padding-left: 5%;
} */
.inputAl {
  height: 35px;
  width: 96%;
  border: none;
  text-align: center;
}
.list {
  height: 90px;
  width: 100%;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
}
.list1 {
  display: flex;
  justify-content: center;
  width: 10%;
}
.list_left {
  width: 18%;
  margin-left: 3%;
  display: flex;
  flex-direction: column;
}
.list_img {
  width: 100%;
  height: 70px;
  border-radius: 10px;
}
.list_right {
  width: 64%;
}
.col1 {
  width: 100%;
  margin-left: 2%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 20px;
  font-size: 15px;
}
.col2 {
  font-weight: bold;
}
.col3 {
  font-size: 14px;
  color: #999999;
}
.col4,
.col5 {
  font-size: 14px;
  color: #000;
}
.inputList{
  position: absolute;
  left: 12px;
  top: 10px;
  display: flex;
  flex-wrap: wrap;
}
.inputList img{
  width: 30px;
  height: 30px;
  border-radius: 10%;
}
</style>